home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 630 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.1 KB

  1. Path: news.th-darmstadt.de!news
  2. From: Enno Sandner <enno@intellektik.informatik.th-darmstadt.de>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Question on null pointers
  5. Date: Fri, 05 Jan 1996 15:04:45 +0100
  6. Organization: Fachbereich Informatik, TH Darmstadt
  7. Message-ID: <30ED2FFD.794BDF32@intellektik.informatik.th-darmstadt.de>
  8. References: <4chov6$ms@tamarack.cs.mtu.edu>
  9. NNTP-Posting-Host: kitz.intellektik.informatik.th-darmstadt.de
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b4 (X11; I; SunOS 4.1.3 sun4m)
  14.  
  15. Saurabh Jang wrote:
  16. > ANSI C clearly allows constructs of the form
  17. > if ( p ) or if ( !p ) where p is a pointer variable. Is this legal in ANSI C++?
  18. > Or is the preferred style if ( p != 0 ) or if ( p != NULL ) ?
  19. > Reading the ARM I felt that this topic was left ambiguous. Or did I miss
  20. > something?
  21.  
  22. Remember that C++ is intended to be an extension of C (with some minor
  23. exceptions). So constructs that are valid in C and not explicitly 
  24. forbidden in C++ should remain valid in C++.
  25. The occurences of 'p' and '!p' do both form valid C++-expressions if
  26. 'p' is a pointer.
  27.  
  28.     Enno
  29.